package com.easy.query.core.proxy.core.tuple.proxy;

import com.easy.query.core.proxy.PropTypeColumn;
import com.easy.query.core.proxy.SQLSelectAsExpression;
import com.easy.query.core.proxy.columns.SQLAnyColumn;
import com.easy.query.core.proxy.columns.types.SQLAnyTypeColumn;
import com.easy.query.core.proxy.core.draft.proxy.AbstractDraftProxy;
import com.easy.query.core.proxy.core.tuple.Tuple3;
import com.easy.query.core.proxy.fetcher.AbstractFetcher;
import com.easy.query.core.util.EasyObjectUtil;

import java.util.Optional;

/**
 * this file automatically generated by easy-query, don't modify it
 * 当前文件是easy-query自动生成的请不要随意修改
 *
 * @author xuejiaming
 */
public class Tuple3Proxy<T1,T2,T3> extends AbstractDraftProxy<Tuple3Proxy<T1,T2,T3>, Tuple3<T1,T2,T3>> {

    private static final Class<Tuple3> entityClass = Tuple3.class;


    public Tuple3Proxy(PropTypeColumn<T1> column1, PropTypeColumn<T2> column2, PropTypeColumn<T3> column3) {
        super(3);
        fetch(0, column1, "value1");
        fetch(1, column2, "value2");
        fetch(2, column3, "value3");
    }

    /**
     * {@link Tuple3#getValue1}
     */
    public SQLAnyTypeColumn<Tuple3Proxy<T1,T2,T3>, T1> value1() {
        return getAnyTypeColumn("value1",EasyObjectUtil.typeCastNullable(Optional.ofNullable(getDraftPropTypes()[0]).map(o->o.getPropertyType()).orElse(null)));
    }

    /**
     * {@link Tuple3#getValue2()}
     */
    public SQLAnyTypeColumn<Tuple3Proxy<T1,T2,T3>, T2> value2() {
        return getAnyTypeColumn("value2",EasyObjectUtil.typeCastNullable(Optional.ofNullable(getDraftPropTypes()[1]).map(o->o.getPropertyType()).orElse(null)));
    }
    /**
     * {@link Tuple3#getValue3()}
     */
    public SQLAnyTypeColumn<Tuple3Proxy<T1,T2,T3>, T3> value3() {
        return getAnyTypeColumn("value3",EasyObjectUtil.typeCastNullable(Optional.ofNullable(getDraftPropTypes()[2]).map(o->o.getPropertyType()).orElse(null)));
    }


    @Override
    public Class<Tuple3<T1,T2,T3>> getEntityClass() {
        return EasyObjectUtil.typeCastNullable(entityClass);
    }


    /**
     * 数据库列的简单获取
     *
     * @return
     */
    public Tuple3ProxyFetcher<T1,T2,T3> FETCHER = new Tuple3ProxyFetcher<>(this, null, SQLSelectAsExpression.empty);


    public static class Tuple3ProxyFetcher<TF1,TF2,TF3> extends AbstractFetcher<Tuple3Proxy<TF1,TF2,TF3>, Tuple3<TF1,TF2,TF3>, Tuple3ProxyFetcher<TF1,TF2,TF3>> {

        public Tuple3ProxyFetcher(Tuple3Proxy<TF1,TF2,TF3> proxy, Tuple3ProxyFetcher<TF1,TF2,TF3> prev, SQLSelectAsExpression sqlSelectAsExpression) {
            super(proxy, prev, sqlSelectAsExpression);
        }


        /**
         * {@link Tuple3#getValue1}
         */
        public Tuple3ProxyFetcher<TF1,TF2,TF3> value1() {
            return add(getProxy().value1());
        }


        /**
         * {@link Tuple3#getValue2}
         */
        public Tuple3ProxyFetcher<TF1,TF2,TF3> value2() {
            return add(getProxy().value2());
        }
        /**
         * {@link Tuple3#getValue3}
         */
        public Tuple3ProxyFetcher<TF1,TF2,TF3> value3() {
            return add(getProxy().value3());
        }


        @Override
        protected Tuple3ProxyFetcher<TF1,TF2,TF3> createFetcher(
                Tuple3Proxy<TF1,TF2,TF3> cp,
                AbstractFetcher<Tuple3Proxy<TF1,TF2,TF3>, Tuple3<TF1,TF2,TF3>, Tuple3ProxyFetcher<TF1,TF2,TF3>> prev,
                SQLSelectAsExpression sqlSelectExpression
        ) {
            return new Tuple3ProxyFetcher<>(cp, this, sqlSelectExpression);
        }
    }

}
